package cn.scm.server.multistage.controller;

import cn.scm.server.multistage.base.ResultDTO;
import cn.scm.server.multistage.dto.BizCreditGrantingRecordDTO;
import cn.scm.server.multistage.param.BizCreditGrantingRecordParam;
import cn.scm.server.multistage.service.BizCreditGrantingRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 授信记录表(BizCreditGrantingRecord)表控制层
 *
 * @author makejava
 * @since 2020-09-23 20:51:27
 */
@RestController
@RequestMapping("creditGranting/")
@Api(tags = "授信管理")
public class BizCreditGrantingRecordController {
    /**
     * 服务对象
     */
    @Resource
    private BizCreditGrantingRecordService bizCreditGrantingRecordService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    @ApiOperation("查看授信记录详情")
    public ResultDTO<BizCreditGrantingRecordDTO> selectOne(String id) {
        this.bizCreditGrantingRecordService.queryById(id);
        return ResultDTO.success(new BizCreditGrantingRecordDTO());
    }


    @PostMapping("save")
    @ApiOperation("添加授信记录")
    public ResultDTO<BizCreditGrantingRecordDTO> save(@RequestBody BizCreditGrantingRecordParam param) {
        //TODO
        return ResultDTO.success(new BizCreditGrantingRecordDTO());
    }

    @PostMapping("update")
    @ApiOperation("修改授信记录")
    public ResultDTO<BizCreditGrantingRecordDTO> update(@RequestBody BizCreditGrantingRecordParam param) {
        //TODO
        return ResultDTO.success(new BizCreditGrantingRecordDTO());
    }

    @PostMapping("queryAll")
    @ApiOperation("获取授信记录列表")
    public ResultDTO<List<BizCreditGrantingRecordDTO>> queryAll(@RequestBody BizCreditGrantingRecordParam param) {
        //TODO
        ArrayList<BizCreditGrantingRecordDTO> bizCreditGrantingRecordDTOS = new ArrayList<>();
        return ResultDTO.success(bizCreditGrantingRecordDTOS);
    }

}